<template>
  <div class="add">
    <div class="listMain flex flex-d">
      <div class="lineDiv flex ai-c">
        <div class="lableDiv">模板名称：</div>
        <Input clearable placeholder="请输入模版名称" style="width: 300px" />
      </div>
      <div class="lineDiv flex ai-c">
        <div class="lableDiv">模板级别：</div>
        <Select v-model="tGrade" style="width:300px;text-align:left;">
          <Option value="1">子模板</Option>
          <Option value="2">父模板</Option>
        </Select>
      </div>
      <!-- 父模板 -->
      <div class="lineDiv flex ai-c" v-if="tGrade==2">
        <div class="lableDiv">子模板选择：</div>
        <Select v-model="tChild" style="width:300px;text-align:left;">
          <Option value="1">第一个子模板</Option>
        </Select>
        <Button type="primary" style="width: 150px;margin-left: 20px;">添加至此父模板</Button>
      </div>
      <div class="lineDiv flex jc-sb" v-if="tGrade==2">
        <div class="lableDiv">子模板列表：</div>
        <div class="width-100">
          <Table stripe :columns="columnsChild" :data="dataChild"></Table>
        </div>
      </div>
      <!-- 子模板 -->
      <div class="lineDiv flex ai-c" v-if="tGrade==1">
        <div class="lableDiv">字段设置：</div>
        <div class="addField flex ai-c">
          <div class="addIcon">+</div>
          <div class="addTitle" @click="addChildField">新增字段</div>
        </div>
      </div>
      <div class="lineDiv flex ai-c jc-sb" v-if="tGrade==1">
        <div class="lableDiv"></div>
        <div class="width-100">
          <Table stripe :columns="columnsChild" :data="dataChild"></Table>
        </div>
      </div>
      <div class="lineDiv flex ai-c" v-if="tGrade==1">
        <div class="lableDiv">模板品类：</div>
        <Select v-model="tPl" style="width:300px;text-align:left;">
          <Option value="1">冰品</Option>
        </Select>
        <div class="lableDiv" style="margin-left:50px;">需求来源：</div>
        <Select v-model="tXq" style="width:300px;text-align:left;">
          <Option value="1">客户需求</Option>
        </Select>
      </div>
      <div class="lineDiv flex ai-c" v-if="tGrade==1">
        <div class="lableDiv">模板平台：</div>
        <Select v-model="tPt" style="width:300px;text-align:left;">
          <Option value="1">京东</Option>
        </Select>
      </div>
      <div class="lineDiv flex ai-c" v-if="tGrade==1">
        <div class="lableDiv">推荐等级：</div>
        <Select v-model="tDj" style="width:300px;text-align:left;">
          <Option value="1">10</Option>
        </Select>
      </div>
      <div class="lineDiv flex ai-c">
        <div class="lableDiv">等级限制：</div>
        <Select v-model="tDjxz" style="width:300px;text-align:left;">
          <Option value="1">1</Option>
        </Select>
        <div class="lableDiv" style="margin-left:50px;">段位限制：</div>
        <Select v-model="tDwxz" style="width:300px;text-align:left;">
          <Option value="1">初出茅庐</Option>
        </Select>
      </div>
      <div class="commitBtn flex jc-c">
        <Button type="primary" style="margin-right:20px;">取消</Button>
        <Button type="primary">提交审核</Button>
      </div>
    </div>
    <!-- 新增字段 -->
    <Modal v-model="addField" width="520">
      <p slot="header" class="headerStyle">
        <span>新增字段</span>
      </p>
      <div class="modulMain">
        <div class="lineModul flex ai-c">
          <div class="labalModul">字段展示名称：</div>
          <Input v-model="mZdname" clearable placeholder="请输入字段名称" />
        </div>
        <div class="lineModul flex ai-c">
          <div class="labalModul">字段填写方式：</div>
          <Select v-model="mTxfs" style="text-align:left;">
            <Option value="1">是/否</Option>
          </Select>
        </div>
      </div>
      <div slot="footer" class="flex jc-c">
        <Button type="primary" style="margin-right:20px;" @click="closeModal">取消</Button>
        <Button type="primary">确定添加</Button>
      </div>
    </Modal>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        tGrade:'1',
        tChild:'1',
        tPl:'1',
        tXq:'1',
        tPt:'1',
        tDj:'1',
        tDjxz:'1',
        tDwxz:'1',
        columnsChild:[
          {
            title: '字段名称',
            align: 'center',
            key: 'name'
          },
          {
            title: '填写方式',
            align: 'center',
            key: 'txfs'
          },
          {
            title: '是否必填',
            align: 'center',
            key: 'sfbt'
          },
          {
            title: '逻辑关系',
            align: 'center',
            key: 'ljgx'
          },
          {
            title: '备注',
            align: 'center',
            key: 'bz'
          },
          {
            title: '操作',
            key: 'action',
            align: 'center',
            // fixed: 'right',
            width: 150,
            render: (h, params) => {
              return h('div', [
                h('span', {
                  style:{
                    color:"#5272E2",
                    cursor: "pointer",
                    padding:"0 5px"
                  },
                  props: {
                    type: 'text',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      
                    }
                  }
                }, '处理'),
                h('span', {
                  style:{
                    color:"#E25252",
                    cursor: "pointer",
                    padding:"0 5px"
                  },
                  props: {
                    type: 'text',
                    size: 'small'
                  },
                  on: {
                    click: () => {
                      
                    }
                  }
                }, '删除')
              ]);
            }
          }
        ],
        dataChild:[
          {
            name:"aa"
          }
        ],
        // 弹框
        addField:false,
        mZdname:"",
        mTxfs:"1",
      }
    },
    mounted(){
      
    },
    methods: {
      //打开新增字段弹框
      addChildField(){
        this.addField=true;
      },
      //关闭新增字段弹框
      closeModal(){
        this.addField=false;
      },
    }
  }
</script>

<style lang="scss" scoped>
  .add{
    background-color: #F5F5F5;
    padding: 30px;
    .listMain{
      width: 100%;
      height: calc(100vh - 120px);
      box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
      background-color: #fff;
      padding: 20px;
      overflow-y: scroll;
      position: relative;
      .lineDiv{
        padding-bottom: 20px;
        .lableDiv{
          font-size: 14px;
          font-family: 'SourceHanSansCN-Medium, SourceHanSansCN';
          font-weight: 500;
          color: #333333;
          width: 85px;
          text-align: right;
          flex: 0 0 85px;
        }
        .addField{
          cursor: pointer;
          .addIcon{
            width: 14px;
            height: 14px;
            border: 1px solid #5272E2;
            line-height: 14px;
            text-align: center;
          }
          .addTitle{
            font-size: 14px;
            font-family: 'SourceHanSansCN-Regular, SourceHanSansCN';
            font-weight: 400;
            color: #5272E2;
            margin-left: 5px;
            padding-top: 2px;
          }
        }
      }
      .commitBtn{
        padding:30px 0
      }
    }
  }
  //弹框样式start
  .headerStyle{
    font-size: 18px;
    font-family: 'SourceHanSansCN-Medium, SourceHanSansCN';
    font-weight: 500;
    color: #333333;
    text-align: center;
  }
  /deep/ .ivu-modal-header{
    border-bottom: none !important;
    padding: 30px 0 10px;
  }
  /deep/ .ivu-modal-body{
    padding: 16px 35px !important;
  }
  /deep/ .ivu-modal-footer{
    border-top: none !important;
    padding: 30px 0;
  }
  .modulMain{
    .lineModul{
      padding-bottom: 20px;
      .labalModul{
        font-size: 14px;
        font-family: 'SourceHanSansCN-Medium, SourceHanSansCN';
        font-weight: 500;
        color: #333333;
        width: 100px;
        text-align: right;
        flex: 0 0 100px;
      }
    }
  }
  //弹框样式end
</style>
